﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using dbPoll_Application.ViewModels;
using dbPoll_Application.Models;
using System.Web.Routing;
using dbPoll_Application.Helpers;

namespace dbPoll_Application.Controllers
{
    public class HelpController : Controller
    {
        [Authorize(Roles="Poll Master")]
        public ActionResult Index(String page)
        {

            String help;

            if (page.Equals("poll_index") || page.Equals("poll_participants") || page.Equals("poll_questions") ||
                    page.Equals("poll_entityhierarchy") || page.Equals("participant_editlist") ||
                    page.Equals("poll_listofparticipants") || page.Equals("participant_addweb")) {
                help = "PollHelp";
            } else if (page.Equals("question_editcustom")) {
                help = "CreatePollHelp";
            } else if (page.Equals("poll_run") || page.Equals("poll_setsession")) {
                help = "PollRunHelp";
            } else if (page.Equals("poll_test")) {
                help = "PollTestHelp";
            } else if (page.Equals("account_myaccount") || page.Equals("account_changepersonaldetails") ||
                    page.Equals("account_changesecurityquestionandanswer") || page.Equals("account_changepassword")) {
                help = "MyAccountHelp";
            } else if (page.Equals("account_manageaccounts") || page.Equals("account_accountmanager")) {
                help = "UserAccountsHelp";
            } else if (page.Equals("poll_reports") || page.Equals("poll_questionreporttextual") || 
                    page.Equals("poll_questionreportgraphical") || page.Equals("poll_demographicreporttextual") ||
                    page.Equals("poll_demographicreportgraphical") || page.Equals("poll_sessionparticipationtextual") ||
                    page.Equals("poll_sessionparticipationgraphical"))
            {
                help = "ReportHelp";
            } else {
                help = "HomeHelp";
            }

            HelpViewModel viewModel = new HelpViewModel(page, help);
            return View(viewModel);

        }

    }
}
